use super::Language_Parser;
use std::fs;
use tree_sitter::Parser;

pub struct JavaScript_Parser {}

impl Language_Parser for JavaScript_Parser {
    fn filter(&self, file_name: &String) -> bool {
        file_name.ends_with(".java")
    }

    fn get_tree_sitter(&self) -> Parser {
        let mut parser = Parser::new();
        parser
            .set_language(&tree_sitter_javascript::LANGUAGE.into())
            .expect("tree-sitter-go not exists");
        return parser;
    }
}

#[test]
fn test() {
    let funcs = JavaScript_Parser {}.find_functions("assets/test_src/personal-sign.js".to_string());
    println!("{}", funcs.len())
}
